#include<iostream>
#include"ShareMemory.hpp"
#include"Time.hpp"
#include"Fifo.hpp"

int main()
{

    share.GetShm();
    share.AttachShm();
    f.OpenPipeForWrite();
    data*image=(data*)share.getaddr();
    int n=5;
    while(n--)
    {
        std::cout<<n<<std::endl;
        //fflush(stdout);
        strcpy(image->status,"最新");
        strcpy(image->lasttime,GetCurrTime().c_str());
        strcpy(image->image,"XXXXXXXXXXXXXXXXXXXXX");
        f.Signal();
        sleep(3);
    }
    //写入
    // char ch='a';
    // while(ch<='z')
    // {
    //     addr[ch-'a']=ch;
    //     ch++;
    //     sleep(3);
    // }
    share.DetachShm();
    return 0;
}